/**
 * MedicalHistory.java
 * @author Peter
 */
package edu.gatech.coc.betameisters.infoholders;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

/**
 * Medical History class that holds medical information about patient it is assigned to
 * @author Peter
 * @version 1.0
 */
public class MedicalHistory implements Serializable{
        
        /**
         * Serial ID
         */
        private static final long serialVersionUID = -4541788912390412993L;

        /**
         * Field age - patient's age
         */
        private int age;
        
        /**
         * Enum for person's Gender
         */
        public enum Gender{ MALE, FEMALE }
        
        /**
         * Field gender - patient's gender
         */
        private Gender gender;
        
        /**
         * Field phoneNumber - patient's contact number
         */
        private String phoneNumber;
        
        /**
         * Field address - patient's home address
         */
        private String address;
        
        /**
         * Field city - patient's city
         */
        private String city;
        
        /**
         * Field state
         */
        private String state;
        
        /**
         * Field zipCode - the zip code
         */
        private int zipCode;
        
        /**
         * Field insurance - patient's insurance provider
         */
        private String insurance;
        
        /**
         * Field dateOfBirth - patient's birthday
         */
        private String dateOfBirth;

        /**
         * Field treatmentRecord - holds the treatment history of patient
         */
        private List<Treatment> treatmentRecord;
        
        /**
         * Field otherInfo
         */
        private String otherInfo;

        /**
         * Field weightOverTime
         */
        public double[] weightOverTime;
        
        /**
         * Field heightOverTime
         */
        public double[] heightOverTime;
        
        /**
         * Size of weightOverTime and heightOverTime arrays
         */
        public static final int GRAPH_MAX = 50;

        /**
         * Default constructor WILL BE
         */
        public MedicalHistory(){
                treatmentRecord = new LinkedList<Treatment>();
                weightOverTime = new double[GRAPH_MAX];
                heightOverTime = new double[GRAPH_MAX];
        }

        /**
         * Constructor that fills up the medical history 
         * @param anAddr - patient's address
         * @param aPhoneNumber - patient's phone number
         * @param aGender - patient's gender
         * @param aDateOfBirth - patient's date of birth
         * @param anInsurance - patient's insurance provider
         */
        public MedicalHistory(final String anAddr, final String aPhoneNumber,  // $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.constructorsOnlyInvokeFinalMethods
                        final Gender aGender, final String aDateOfBirth, final String anInsurance){
                setAddress(anAddr);
                setPhoneNumber(aPhoneNumber);
                setGender(aGender);
                setDateOfBirth(aDateOfBirth);
                setInsurance(anInsurance);
                treatmentRecord = new LinkedList<Treatment>();
                weightOverTime = new double[GRAPH_MAX];
                heightOverTime = new double[GRAPH_MAX];
        }
        
        /**
         * Set or change the patient's age
         * @param age
         */
        public void setAge(int age) {
                this.age = age;
        }

        /**
         * Gets the patient's age
         * @return age
         */
        public int getAge() {
                return age;
        }
        
        /**
         * Set or change the patient's gender 0_0
         * @param gender
         */
        public void setGender(Gender gender) {
                this.gender = gender;
        }

        /**
         * Gets the patient's gender
         * @return gender
         */
        public Gender getGender() {
                return gender;
        }

        /**
         * Set or change the patient's phone number
         * @param phoneNumber
         */
        public void setPhoneNumber(String phoneNumber) {
                this.phoneNumber = phoneNumber;
        }

        /**
         * Gets the patient's phone number
         * @return phoneNumber
         */
        public String getPhoneNumber() {
                return phoneNumber;
        }

        /**
         * Set or change the patient's address 
         * @param address
         */
        public void setAddress(String address) {
                this.address = address;
        }

        /**
         * Gets the patient's address
         * @return address
         */
        public String getAddress() {
                return address;
        }

        /**
         * @param city the city to set
         */
        public void setCity(String city) {
                this.city = city;
        }

        /**
         * @return the city
         */
        public String getCity() {
                return city;
        }

        /**
         * @param state the state to set
         */
        public void setState(String state) {
                this.state = state;
        }

        /**
         * @return the state
         */
        public String getState() {
                return state;
        }

        /**
         * @param zipCode the zipCode to set
         */
        public void setZipCode(int zipCode) {
                this.zipCode = zipCode;
        }

        /**
         * @return the zipCode
         */
        public int getZipCode() {
                return zipCode;
        }

        /**
         * Set or change the patient's insurance provider 
         * @param insurance
         */
        public void setInsurance(String insurance) {
                this.insurance = insurance;
        }

        /**
         * Gets the patient's insurance
         * @return insurance
         */
        public String getInsurance() {
                return insurance;
        }

        /**
         * Set or change the patient's date of birth 
         * @param dateOfBirth
         */
        public void setDateOfBirth(String dateOfBirth) {
                this.dateOfBirth = dateOfBirth;
        }

        /**
         * Gets the patient's date of birth
         * @return dateOfBirth
         */
        public String getDateOfBirth() {
                return dateOfBirth;
        }
        
        /**
         * Set or change the patient's treatment records 
         * @param treatmentRecord
         */
        public void setTreatmentRecord(List<Treatment> treatmentRecord) {
                this.treatmentRecord = treatmentRecord;
        }

        /**
         * Gets the patient's getTreatmentRecord
         * @return treatmentRecord
         */
        public List<Treatment> getTreatmentRecord() {
                return treatmentRecord;
        }
        
        /**
         * Sets any other misc information about patient
         * @param otherInfo - other information about patient (includes allergies and etc.)
         */
        public void setOtherInfo(String otherInfo) {
                this.otherInfo = otherInfo;
        }

        /**
         * Gets other misc information about patient
         * @return otherInfo
         */
        public String getOtherInfo() {
                return otherInfo;
        }

        /**
         * Sets the patient's weight over time
         * @param weight the patients weight over time
         */
        public void setWeightHis(double[] weight){
                weightOverTime = weight.clone();
        }
        
        /**
         * Gets the patient's weight over time
         * @return the weight history as an array of doubles
         */
        public double[] getWeightHis(){
                return weightOverTime.clone();
        }
        
        /**
         * Sets the patient's height over time
         * @param height the patients height over time
         */
        public void setHeightHis(double[] height){
                // copy the array
                heightOverTime = new double[height.length];
                System.arraycopy(height, 0, heightOverTime, 0, height.length);
        }
        
        /**
         * Gets the patient's height over time
         * @return the height history as an array of doubles
         */
        public double[] getHeightHis(){
                return heightOverTime;
        }
        
        /**
         * Overrides the default toString method
         *
         * @return Patient's medical history
         */
        public String toString(){
                return "This patient's information and medical history\n" + 
                           "INFORMATION\n" + 
                           "ADDRESS: " + address + "\n" +
                           "PHONE NUMBER: " + phoneNumber + "\n" +
                           "DATE OF BIRTH: " + dateOfBirth + "\n" +
                           "INSURANCE PROVIDER: " + insurance + "\n" +
                           "MEDICAL HISTORY\n" +
                           "GENDER: " + gender + "\n" +
                           "AGE: " + age + "\n";
        }

}